﻿#pragma once
#include "stdafx.h"
#include "SciVision.h"
// FindCircleDlg 对话框
using namespace SCIVISION;
typedef struct FindCircleParam
{
	SciROI ROI;
	SciRegion Region;
	SciCircleEdgeDirection edgeDirection;
	SciEdgePolarity edgePolarity;
	SciEdgeType edgeType;
	int minEdgeStrength;
	int searchLineCount;
	int rejectRatio;
	int edgeWidth;
	int projectionWidth;
	bool display;
	FindCircleParam()
	{
		//! 获取初始参数
		SciFindCircleDlg sciFindCircle;
		sciFindCircle.GetParam(&ROI,
			&edgeDirection,
			&edgePolarity,
			&edgeType,
			&minEdgeStrength,
			&searchLineCount,
			&rejectRatio,
			&edgeWidth,
			&projectionWidth,
			&display);
	}
}FindCircleParam;
class FindCircleDlg : public CDialogEx
{
	DECLARE_DYNAMIC(FindCircleDlg)

public:
	FindCircleDlg(CWnd* pParent = nullptr);   // 标准构造函数
	virtual ~FindCircleDlg();

// 对话框数据
#ifdef AFX_DESIGN_TIME
	enum { IDD = IDD_FindCircleDlg };
#endif
private:
	long long m_SciWnd;
	SciImage srcImage;
	SciFindCircle m_FindCircle;
public:

	//获取ROI
	long GetROI(SciROI& roi);

	virtual long SetParam(SciCircleEdgeDirection edgeDirection,
		SciEdgeType edgeType,
		SciEdgePolarity edgePolarity,
		int minEdgeStrength,
		int searchLineCount);
	virtual long GetParam(SciCircleEdgeDirection edgeDirection,
		SciEdgeType edgeType,
		SciEdgePolarity edgePolarity,
		int minEdgeStrength,
		int searchLineCount);
	virtual long Execute(SciImage& image, 
		SciROI& ROI,
		SciPoint* circleCenter,
		float* circleRadius);
protected:
	FindCircleParam FCP;
	void UpdateDlgParams();
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
	
	
	DECLARE_MESSAGE_MAP()
public:
	virtual BOOL OnInitDialog();
	CComboBox cmbEdgeDirection;
	CComboBox cmbEdgePolarity;
	CComboBox cmbEdgeType;
	afx_msg void OnBnClickedOk();
	afx_msg LRESULT OnMoveROI(WPARAM wParam,LPARAM lParam);
	afx_msg void OnBnClickedBtnexecutecircle();
	INT_PTR DoModal(SciImage& image);
	virtual INT_PTR FindCircleDlg::DoModal();

};
